<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrderDetailsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_details', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('order_id')->index()->comment('订单ID');
            $table->bigInteger('goods_id')->index()->comment('产品ID');
            $table->bigInteger('sku_id')->default(0)->comment('货品ID');
            $table->string('goods_name', 255)->comment('商品名称');
            $table->integer('num')->default(0)->comment('数量');
            $table->float('goods_price', 8, 2)->default('0.00')->comment('商品总额');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_details');
    }
}
